package insight.miescor.opp.domain;

import java.util.Date;

import org.sormula.Database;
import org.sormula.SormulaException;
import org.sormula.Table;

public class PRCInput implements Cloneable {

	private int id;
	private int assignmentid;
	private String objectid;
	private Date createdon;
	
	
	public static int generateId(Database database) throws SormulaException {
		NumberGenerator numGen = NumberGenerator.loadNextNum(database,
				"PrcId");

		return numGen.getSeriesCurrentNum();

	}

	public PRCInput() {
	}

	public PRCInput(int assignmentid,String objectid,Database database)
			throws SormulaException {
		this.id = generateId(database);
		this.assignmentid=assignmentid;
		this.objectid=objectid;
		this.createdon=new Date();
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	
	public int getAssignmentid() {
		return assignmentid;
	}

	public void setAssignmentid(int assignmentid) {
		this.assignmentid = assignmentid;
	}

	public String getObjectid() {
		return objectid;
	}

	public void setObjectid(String objectid) {
		this.objectid = objectid;
	}
	
	public Date getCreatedon() {
		return createdon;
	}

	public void setCreatedon(Date createdon) {
		this.createdon = createdon;
	}

	public void insertPRC(Database database) throws SormulaException {
		Table<PRCInput> prcTable = database.getTable(PRCInput.class);
		prcTable.insert(this);
	}
}
